<?php
    header("Content-Type:text/html; charset=utf-8");
    // header("Refresh:5;url=http://www.baidu.com");
    //接收请求、处理请求、完成响应
    $username = $_POST['username'];
    $password = $_POST['password'];
    $loginName = $_POST['loginName'];

    //处理请求 把客户端的数据往数据库里存放

    //建立链接
    $con = mysqli_connect("127.0.0.1","root","","xxy");

    //判断是否已经建立链接
    if(!$con){
        printf("Can't connect to MySQL Server. Errorcode: %s ",mysqli_connect_error());
        exit;
    }

    $sql = "INSERT INTO employee(username,password,loginName) VALUES('$username','$password','$loginName')";

    //使用mysqli_query 函数 通过$con 连接 把$sql发送到数据库
    if(!mysqli_query($con,$sql)){
        die('Error: '.mysql_error());
    }
    //关闭连接
    mysqli_close($con);
    echo "注册成功,5秒后跳到百度";


?>